package com.ruoyi.business.dao;

import com.ruoyi.business.domain.DispatchLists;
import org.springframework.data.repository.query.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;


/**
 * DispatchListsDao接口
 *
 * @author liutietou
 * @since 1.0 2025-07-19
 */
@Repository
public interface DispatchListsDao extends JpaRepository<DispatchLists, Integer>, JpaSpecificationExecutor<DispatchLists> {

    @Query(value ="SELECT  ichildid   FROM  ufsystem..UA_Identity  WHERE  cacc_id=:accountid  AND   cvouchtype='dispatch'  ",nativeQuery = true)
    int  getDispatchsId(@Param("accountid") String  accountid);


    @Modifying
    @Query(value = "UPDATE  ufsystem..UA_Identity  SET  ichildid=:ichildid   WHERE  cacc_id=:accountid  AND   cvouchtype='dispatch'",nativeQuery = true)
    int  updateDispatchsId(@Param("accountid") String accountid, @Param("ichildid") int ichildid);

   @Modifying
    int  deleteByDlid(int dlid);

}
